package com.suixuan.support.log;

import javassist.NotFoundException;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;

@Aspect
public class GenericLoggerBean {

	private LogFactoryThread logFactoryThread = LogFactoryThread.getInstance();

	@SuppressWarnings("unused")
	@Pointcut("execution (* com.suixuan..*.*(..))")
	private void anyMethod() {
	}// 声明一个切入点

	/**
	 * 记录业务方法中錯誤信息日志，包括方法名，方法参数，参数值
	 * 
	 * @param joinPoint
	 *            连接点对象
	 * @return 连接点处的方法
	 */
	@Around("anyMethod()")
	public Object invoke(ProceedingJoinPoint joinPoint) {

		try {
			return joinPoint.proceed();
		} catch (Throwable e) {
//			// 记录错误日志
//			try {
////				LogFactory.logRecord(LogConstant.ERROR,
////						this.logFactoryThread.recordLogs(joinPoint.getTarget()
////								.getClass(),
////								joinPoint.getSignature().getName(), joinPoint
////										.getArgs()), e);
//			} catch (NotFoundException e1) {
//				// TODO Auto-generated catch block
//				e1.printStackTrace();
//			}
//		} finally {
//			// 异步记录正常执行流程日志
//			//this.logFactoryThread.put(joinPoint);
		}
		return null;
	}

}
